using System;
using System.Collections.Generic;
using System.Text;
using DAO;
using DTO;
using System.Data;
namespace BUS
{
    public enum BangCapBUSResult
    {
        OK ,
        DAOERROR
    }
    public class BangCap
    {
        public static BangCapBUSResult SelectAll(List<DTO.BangCap> dsBangCap)
        {
            string sql = "select * from BangCap";
            DAO.Interface bc =new DAO.BangCap();
            DataTable dt = bc.Select(sql);
            if (dt != null)
            {
                for (int i = 0 ; i < dt.Rows.Count ; i++)
                {
                    DTO.BangCap temp = new DTO.BangCap();
                    temp.MaBangCap = dt.Rows[i].ItemArray[0].ToString().Trim();
                    temp.TenBangCap = dt.Rows[i].ItemArray[1].ToString();
                    dsBangCap.Add(temp);
                }
                    return BangCapBUSResult.OK;
            }
            return BangCapBUSResult.DAOERROR;
        }
        public static bool Insert(string sql)
        {
            DAO.BangCap bc = new DAO.BangCap();
            return bc.Insert(sql);
        }
        public static bool Update(string sql)
        {
            DAO.BangCap bc = new DAO.BangCap();
            return bc.Update(sql);
        }
        public static bool Delete(string sql)
        {
            DAO.BangCap bc = new DAO.BangCap();
            return bc.Delete(sql);
        }
        public static DataTable Select(string sql)
        {
            DAO.BangCap bc = new DAO.BangCap();
            return bc.Select(sql);
        }

        public static string LayMaBangCap(string tenBC)
        {
            DAO.BangCap bc = new DAO.BangCap();
            return bc.LayMaBangCap(tenBC);
        }
    }
}
